﻿using System;

using Sunyi.Project.WebPoint.DataContract;
using Sunyi.Project.WebPoint.ServiceContract;

namespace Sunyi.Project.WebPoint.ServiceAccess
{
    public class RoleServiceProxy : WebPointServiceProxy<IRoleService>, IRoleService
    {
        protected override string ClientEndPointName
        {
            get
            {
                return "RoleService";
            }
        }

        public Role GetRole(Guid roleId)
        {
            Role result = null;
            var channel = this.CreateChannel();

            var action = new Action(delegate { result = channel.GetRole(roleId); });

            this.Invoke(channel, action);
            return result;
        }

        public void UpdateRole(Role role)
        {
            var channel = this.CreateChannel();

            var action = new Action(delegate { channel.UpdateRole(role); });

            this.Invoke(channel, action);
        }
    }
}
